package com.cvcetic.ciudadverde.utils;

import java.util.ArrayList;
import java.util.List;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import com.cvcetic.ciudadverde.R;
import com.cvcetic.ciudadverde.beans.Punto;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.Projection;

public class PuntoItemizedOverlay extends ItemizedOverlay<PuntoOverlayItem> {

	private List<PuntoOverlayItem> items;
	private final Context contexto;

	public PuntoItemizedOverlay(List<PuntoOverlayItem> items,
			Drawable MarcaDefecto, Context contexto) {
		super(boundCenterBottom(MarcaDefecto));
		this.items = items;
		Log.d("DebugPuntoItemized",
				"  Items en PuntoItemized  ----------> "+items.size());
		Log.d("DebugPuntoItemized",
				String.format("Items en PuntoItemized (%d)  Marca por defecto (%s)",
						+items.size(),MarcaDefecto.toString()));
		this.contexto = contexto;
		super.populate();
	}





	@Override
	protected boolean onTap(int i) {
		final Punto pt = this.items.get(i).punto;		
		
		Toast.makeText(contexto, pt.getNombre_es()+" "+
				pt.getDireccion(), Toast.LENGTH_SHORT).show();		
		return true;
	}

	@Override
	protected PuntoOverlayItem createItem(int i) {
		return this.items.get(i);
	}

	@Override
	public int size() {
		return this.items.size();
	}
	
	

}
